#include "VOutputWidget.h"
#include "ui_VOutputWidget.h"
#include "VGlobal.h"

VOutputWidget::VOutputWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::VOutputWidget),
	_action_clear(new QAction(QIcon(VGlobal::icon_path.value("clear")), "清空",this)),
	_toolbar(new QToolBar())
{
    ui->setupUi(this);
	init_toolbar();
    connect(_action_clear, &QAction::triggered,[=](){
         ui->textedit_output->clear();
    });
}

VOutputWidget::~VOutputWidget()
{
    delete ui;
}

void VOutputWidget::output_append(QString text)
{
    ui->textedit_output->append(text);
}

void VOutputWidget::output_clear()
{
    ui->textedit_output->clear();
}

QWidget* VOutputWidget::get_expand_widget()
{
	return _toolbar;
}

void VOutputWidget::init_toolbar()
{
	_toolbar->addAction(_action_clear);
}
